To create an image-only PDF, first create a new document, using the PdfDocument.NewDocument method.
|
PDF Xpress™ does not offer native or decompression of image streams used to create PDF pages. ImagXpress® can be used in conjunction with PDF Xpress to provide file decompression and format conversion. |
VB Example |
Copy Code
|
'This code demonstrates converting an image file to a single page PDF file
On Error GoTo error
Dim pdfXpress1 As New PdfXpress
pdfXpress1.Initialize
pdfxpress1.RaiseExceptions = True
Dim document As New PdfDocument
document. SetParentControl pdfXpress1
document.NewDocument
Dim pageOptions As New pageOptions
pageOptions.MediaHeight = 792
pageOptions.MediaWidth = 612
document.CreatePage -1, pageOptions
Dim destinationX As Double
destinationX = 0.25 * 72.0
Dim destinationY As Double
destinationY = 0.25 * 72.0
Dim destinationWidth As Double
destinationWidth = pageOptions.MediaWidth - 0.5 * 72.0
Dim destinationHeight As Double
destinationHeight = pageOptions.MediaHeight - 0.5 * 72.0
Dim destinationFit As pdfImageFitSettings
destinationFit = PDF_ImageFitShrink
document.AddImageFromFile 0, destinationX, destinationY, destinationWidth, destinationHeight, destinationFit, "c:\testImage.jpg", 0
.
.
.
GoTo finish
error:
MsgBox Err.Description
finish:
Set document = Nothing
pdfxpress1.Terminate
Set pdfxpress1= Nothing
|
See Also